//
//  ViewController.m
//  BaseFrameworkOC
//
//  Created by Vicent on 2021/9/6.
//

#import "MainViewController.h"
#import "HomeTableViewController.h"
#import "AccountTableViewController.h"
#import "TestTableViewController.h"

@interface MainViewController ()

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addChildViewControllers];
    NSLog(@"%s",__func__);
}


- (void)addChildViewControllers {
    self.tabBar.tintColor = UIColor.orangeColor;
    [self addChildViewController:[[HomeTableViewController alloc] init] title:@"首页" imageName:@"tabbar_home"];
    [self addChildViewController:[[AccountTableViewController alloc] init] title:@"我" imageName:@"tabbar_profile"];
    [self addChildViewController:[[TestTableViewController alloc] init] title:@"测试" imageName:@"tabbar_profile"];
}

- (void)addChildViewController:(UIViewController *)vc title:(NSString *)title imageName:(NSString *) imageName {
    vc.title = title;
    vc.tabBarItem.image = [UIImage imageNamed:imageName];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
    [self addChildViewController:nav];
}


@end
